package org.itsolutions.javaBackup.properties;

import static java.util.concurrent.TimeUnit.MINUTES;
import static org.itsolutions.javaBackup.definitions.Count.KB128;

/**
 * 
 * @param <T> property type
 * @author Tomas Fecko
 */
public final class GlobalProperty<T> extends AProperty<T> {

	private static final long 	serialVersionUID = 7061400328337354491L;
	private static final String	PROPERTY_FILE_NAME = "global.properties";
	
	/**
	 * 
	 * @param pPropertyKey property key
	 * @param pDefaultValue default value
	 */
	private GlobalProperty(String pPropertyKey, T pDefaultValue) {
		super(pPropertyKey, pDefaultValue);
	}
	
	//CHECKSTYLE:OFF
	///////////////////////////////////////////// Thread pools /////////////////////////////////////////////
	public static final AProperty<Integer> 	SHARED_SCHEDULED_THREAD_POOL_CORE_SIZE = new GlobalProperty<Integer>("rttp.shared.scheduled.thread.pool.core.size", 20); 
	public static final AProperty<Integer> 	SHARED_THREAD_POOL_CORE_SIZE = new GlobalProperty<Integer>("rttp.shared.thread.pool.core.size", 20); 
	public static final AProperty<Integer> 	SHARED_THREAD_POOL_MAX_SIZE = new GlobalProperty<Integer>("rttp.shared.thread.pool.max.size", 500);
	public static final AProperty<Long> 	SHARED_THREAD_POOL_TIMEOUT_MILLIS = new GlobalProperty<Long>("rttp.shared.thread.pool.timeout.in.millis", MINUTES.toMillis(1)); 
	public static final AProperty<Integer> 	JIT_SCHEDULED_THREAD_POOL_CORE_SIZE = new GlobalProperty<Integer>("rttp.jit.scheduled.thread.pool.core.size", 2); 
	public static final AProperty<Integer> 	JIT_THREAD_POOL_CORE_SIZE = new GlobalProperty<Integer>("rttp.jit.thread.pool.core.size", 1); 
	public static final AProperty<Integer> 	JIT_THREAD_POOL_MAX_SIZE = new GlobalProperty<Integer>("rttp.jit.thread.pool.max.size", 4);
	public static final AProperty<Long> 	JIT_THREAD_POOL_TIMEOUT_MILLIS = new GlobalProperty<Long>("rttp.jit.thread.pool.timeout", MINUTES.toMillis(1));
	
	///////////////////////////////////////////// Byte Buffers /////////////////////////////////////////////
	public static final AProperty<Boolean> 	USE_BYTE_BUFFER_POOLS = new GlobalProperty<Boolean>("use.byte.buffer.pool", true);	
	public static final AProperty<Integer> 	NUMBER_OF_BUFFERS = new GlobalProperty<Integer>("number.of.direct.byte.buffers", 4000); 
	public static final AProperty<Integer> 	SIZE_OF_ONE_BYTE_BUFFER = new GlobalProperty<Integer>("size.of.one.byte.buffer", KB128); 
	//CHECKSTYLE:ON
	
	@Override
	protected String getPropertyFileName() {
		return PROPERTY_FILE_NAME;
	}
	
}